Repository navigation
fix(studio): a sealed crop frame turns with its layer - #8310
Merged
Merged
Conversation
Contributor
Edit accuracy: accurate 271 (base branch 271), smooth 78 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (1)
|
vanceingalls
approved these changes
Nov 20, 2026
vanceingalls
left a comment
Collaborator
There was a problem hiding this comment.
Approving at 790fe5ce. I found no blocker.
- The rotation's source.
standInCropFrametakes the angle and box fromoverlayRect, which is the orientedgroupAwareRectfrommeasurePreviewOverlay, built from the frame's corners. Scale is the overlay edge length divided by the press-measured layout, so non-uniform scale holds, and a flip reads as 180° with positive edges, matching the unsealedatan2path. - Scrubbing and selection.
useDomEditOverlayRectsre-measures on the frame loop, so the angle follows a scrub. Nothing stores an angle, andstateis rebuilt per element, so no previous selection's angle leaks. The PR adds no new listeners. - Unsealed path unchanged.
previewStandInis falsy there, so it still readsreadPlanarTransformandoffsetWidth. - Drawn and hit areas agree. The outline and edge handles are children of the same rotated
data-dom-edit-crop-frame. - Trust boundary. It narrows: Studio stops reading
planarfrom the frame, and no new message is added. The body's fails-without line names two tests that fail on main's code.
Non-blocking:
measuredStartOfprefers the heldstate.start.layoutover a newergestureStartLayout, so a size tweened after the press leaves the scale stale. That's the same as main.- Before any press, a scaled layer falls back to the edit scale, so crop insets are mis-scaled until the first press. The body says so.
CropPresetBarstays unrotated. That's pre-existing.
CI: every check finished (58 passed, 20 skipped). Edit accuracy is 271 against a base of 271.
This was referenced Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
In a sealed preview (Studio cannot script the frame), the crop frame of a turned layer now turns with the layer, before any press and after a scrub. Before, it was drawn axis-aligned around the layer until the first press, and after a press it kept the press-time angle when the playhead moved to a frame where GSAP turns the layer differently. An unsealed preview already drew it turned.
The sealed preview is off by default until the sealed-by-default change (#7846) lands, so nothing changes for anyone before then.
Why
A sealed selection is a stand-in: an element in Studio's page with no transform of its own. The crop frame read the turn and scale from the selected element, so for a stand-in it fell back to the axis-aligned box. #8279 gave it the turn and scale from the press (
gesture-start'splanar), held until the selection changed. So the frame was wrong before a press, and stale after a scrub (the first non-blocking note on #8279).How
One owner for a stand-in's turn: the frame's watched geometry of the selection, which Studio already keeps for the overlay and which follows the playhead.
readElementCropFrametakes the turn from the oriented overlay rect (angle and corners from the frame'sgeometry) and its size for the scale.planarfrom thegesture-startreply, soisPlanarOrNulland itsMAX_DRAFT_PXbound on unitless matrix entries (the second note on fix(studio): a sealed crop lands where it was dragged #8279) are deleted, and the parsed reply drops the field. The frame still sendsplanar, so an older Studio keeps working.Test plan
DomEditCropHandles.sealed.test.ts:fails without the fix:
domEditOverlayCrop.ts,DomEditCropHandles.tsx,previewGestureStartRead.tsandpreviewElements.tsas on main, "draws a sealed turned card's crop frame turned before any press" fails ('' vs rotate(30deg)) and "redraws a sealed crop frame at the turn the card has after a scrub, once a press measured it" fails (rotate(29.99…deg) vs rotate(50deg)).Run on Linux at this head: the crop handle, overlay crop, gesture-start read and preview element tests pass three runs in a row (69); Studio's
hooks,components/editor,webmcpandplayertests (6674) pass; Studiovite buildandtscno errors; format and lint clean;fallow auditpasses.Bench
Edit-accuracy bench, every crop case (120 per run:
fromto,hold,idle,keys,late,none,scale,size,spin,tween; r0 and r30; root and nested; 50% and 100% zoom). "Crop frame" is the dashed crop outline tracked against the layer through the press and drag. Compared at main and at this change:45 of the 46 sealed misses on main are on turned layers (r30, or
spin, which GSAP turns), 21 to 93 px off. The other is 1.7 px on an unturnedfromtolayer, within 0.2 px at this change. The sealed undo and redo misses are the same on both sides; this change does not touch them.Before
Sealed preview on main, a layer GSAP turns to 40° at the playhead, selected for crop, before any press: the dashed crop frame and its pill are axis-aligned.
After
The same layer at this change: the crop frame and its pill turn with the layer.